﻿using System;
using System.Web;

namespace NWebMock
{
    public interface ITraceContext
    {
        #region Properties

        /// <summary>
        /// Gets or sets a value indicating whether tracing is enabled for the current Web request.
        /// </summary>
        bool IsEnabled { get; set; }

        /// <summary>
        /// Gets or sets the sorted order in which trace messages should be output to a requesting browser.
        /// </summary>
        TraceMode TraceMode { get; set; }

        #endregion

        #region Methods

        /// <summary>
        /// Writes a trace message to the trace log. All warnings appear in the log as red text.
        /// </summary>
        /// <param name="message">The trace message to write to the log. </param>
        void Warn(string message);

        /// <summary>
        /// Writes trace information to the trace log, including any user-defined categories and trace messages. All warnings appear in the log as red text.
        /// </summary>
        /// <param name="category">The trace category that receives the message.</param>
        /// <param name="message">The trace message to write to the log.</param>
        void Warn(string category, string message);

        /// <summary>
        /// Writes trace information to the trace log, including any user-defined categories, trace messages, and error information. All warnings appear in the log as red text.
        /// </summary>
        /// <param name="category">The trace category that receives the message.</param>
        /// <param name="message">The trace message to write to the log.</param>
        /// <param name="errorInfo">An Exception that contains information about the error.</param>
        void Warn(string category, string message, Exception errorInfo);

        /// <summary>
        /// Writes a trace message to the trace log.
        /// </summary>
        /// <param name="message">The trace message to write to the log.</param>
        void Write(string message);

        /// <summary>
        /// Writes trace information to the trace log, including a message and any user-defined categories.
        /// </summary>
        /// <param name="category">The trace category that receives the message.</param>
        /// <param name="message">The trace message to write to the log.</param>
        void Write(string category, string message);

        /// <summary>
        /// Writes trace information to the trace log, including any user-defined categories, trace messages, and error information.
        /// </summary>
        /// <param name="category">The trace category that receives the message.</param>
        /// <param name="message">The trace message to write to the log.</param>
        /// <param name="errorInfo">An Exception that contains information about the error.</param>
        void Write(string category, string message, Exception errorInfo);

        #endregion

        #region Events

        /// <summary>
        /// Raised by the TraceContext object to expose trace messages after all request information is gathered.
        /// </summary>
        event TraceContextEventHandler TraceFinished;

        #endregion
    }
}
